<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/vue/3.0.2/vue.global.js"></script>
</head>
<body>
    <div id="app"></div>
</body>
<script>
    const app = Vue.createApp({
        data(){
            return{

            }
        },
        // 向孙子组件传递的数据
        provide:{
            newdata:'向孙子组件传递的数据'
        },
        methods:{

        },
        template:`
            <one />
        `
    })
    app.component("one",{
        template:`
            <two />
        `
    })
    app.component("two",{
        inject:['newdata'],
        template:`
            <div>{{newdata}}</div>
        `
    })
    app.mount("#app")
</script>
</html>